SHELL = bash -Eeuo pipefail

GUILE_LOAD_PATH_ADDITIONS := lib
GUILE_LOAD_PATH_ADDITIONS += lib/guile-user-input-output
GUILE_LOAD_PATH_ADDITIONS += lib/guile-random-utils

GUILE_LOAD_PATH_ARGUMENTS := -L . $(foreach dir,$(GUILE_LOAD_PATH_ADDITIONS),-L $(dir))

# test stuff
GUILE_TEST_DIR := test
GUILE_TEST_LOAD_PATH_ARGS := -L .
GUILE_TEST_LOAD_PATH_ARGS += -L $(GUILE_TEST_DIR)
GUILE_TEST_LOAD_PATH_ARGS += $(foreach dir,$(GUILE_LOAD_PATH_ADDITIONS),-L $(dir))


VOCABULARY_FILENAME := data/lessons.json


.PHONY: run clean test


run:
	guile $(GUILE_LOAD_PATH_ARGUMENTS) main.scm --vocabulary="$(VOCABULARY_FILENAME)"

test:
	guile $(GUILE_TEST_LOAD_PATH_ARGS) $(GUILE_TEST_DIR)/test-vocabulary-data.scm
	guile $(GUILE_TEST_LOAD_PATH_ARGS) $(GUILE_TEST_DIR)/test-vector-procs.scm
	guile $(GUILE_TEST_LOAD_PATH_ARGS) $(GUILE_TEST_DIR)/test-search.scm
	guile $(GUILE_TEST_LOAD_PATH_ARGS) $(GUILE_TEST_DIR)/test-alist-procs.scm
	guile $(GUILE_TEST_LOAD_PATH_ARGS) $(GUILE_TEST_DIR)/test-math.scm

clean:
	rm --verbose *.log || true;
